package yhao.infra.feature.alipay.core.request.query;

import com.alipay.api.AlipayApiException;
import com.alipay.api.request.AlipayTradeQueryRequest;
import com.alipay.api.response.AlipayTradeQueryResponse;
import yhao.infra.feature.alipay.core.BaseAliPayRequest;

/**
 * 统一收单线下交易查询
 * @see <a href="https://docs.open.alipay.com/api_1/alipay.trade.query/">更多细节</a>
 */
public class TradeQueryRequest extends BaseAliPayRequest<AlipayTradeQueryResponse> {
    public TradeQueryRequest(String out_trade_no) {
        super(out_trade_no);
    }

    @Override
    protected AlipayTradeQueryResponse doRequest() {
        AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();//创建API对应的request类
        request.setBizContent(bizContent);//设置业务参数

        String method = logRequest(request);
        try {
            return alipayClient.execute(request);
        } catch (AlipayApiException e) {
            logger.error(method+getOut_trade_no(), e.getMessage());
        }
        return null;
    }
}
